package dbLayer;

import java.sql.SQLException;
import java.util.List;

import modelLayer.ClassRoom;;

public interface DBClassRoomIF {

	/**
	 * Inserts a new row into the database table ClassRoom. This method
	 * uses prepared statements to sanitize our database input.
	 * 
	 * @param	name		String	class room name.
	 * @param	purpose		String	what the class room is used for.
	 * @throws	Exception			throws SQL exceptions if the query isn't
	 * 								legal.
	 * @return	rc			int		count of rows affected by the query execution in the database
	 */
	public int insert(String name, String purpose) throws Exception;

	/**
	 * Finds a row in the database table ClassRoom. Note that
	 * class room names are typically unique, and therefore used as an
	 * id.
	 * 
	 * @param	name		String		class room name.
	 * @throws				Exception	throws SQL exceptions if the query isn't
	 * 									legal.
	 * @return				ClassRoom	returns the classRoom matching the search.
	 */
	public ClassRoom find(String name) throws Exception;

	/**
	 * Finds a row in the database table ClassRoom. 
	 * 
	 * @param	id			int			class room id.
	 * @throws				Exception	throws SQL exceptions if the query isn't
	 * 									legal.
	 * @return				ClassRoom	returns the classRoom matching the search.
	 */
	public ClassRoom findById(int id) throws Exception;
	
	/**
	 * Finds all rows in the database table ClassRoom. 
	 * 
	 * @throws				Exception		throws SQL exceptions if the query isn't
	 * 										legal.
	 * @return				List<ClassRoom>	returns a list of all class rooms.
	 */
	public List<ClassRoom> getAll() throws Exception;
	
	/**
	 * Updates a row in the database table ClassRoom. 
	 * 
	 * @param	id			int			class room id.
	 * @param	name		String		the new value of the name column.
	 * @param	purpose		String		the new value of the purpose column.
	 * @throws				Exception	throws SQL exceptions if the query isn't
	 * 									legal.
	 * @return	rc			int			count of rows affected by the query execution in the database
	 */
	public int update(int id, String name, String purpose) throws SQLException;
	
	/**
	 * Removes a row in the database table ClassRoom. 
	 * 
	 * @param	name		String		the name value in the row to be removed.
	 * @throws	Exception				throws SQL exceptions if the query isn't
	 * 									legal.
	 * @return	rc			int			count of rows affected by the query execution in the database
	 */
	public int remove(String name) throws Exception;
	
}